
jBGallery.Settings = function(){
  return {
      //option   : default value     //see docs/demo for usage - PLEASE FIX MY ENGLISH IF YOU CAN & SEND ME  :)
    style    : "centered",       //"centered"|"zoom"|"original" - image style
    menu     : "slider",         //false|"numbers"|"simple"|"slider" - menu type
    shortcuts: [37, 39],         //[prev,next] - keyboard code shortcuts
    slideshow: false,            //true|false - autostart slideshow
    fade     : true,             //true|false - disable all fade effects
    popup    : false,            //true|false - modal box & traditional popup hack to display multiple gallery (3.0 : fullscreen:false)
    randomize: 0,                //0|1|2 - randomize first image (1) or randomize "slideshow" (2) - blackout: http://www.grayhats.org
    caption  : true,             //true|false - show/disable internal caption system
    autohide : false,            //true|false - auto hide menu & caption
    clickable: false,            //true|false - "image click & go"
    current  : 1,                //number     - set initial photo (modal "hack" - see demo. don't use "hash". jbgallery use "location.hash" only in popup mode)
    webkit   : (navigator.userAgent.toLowerCase().search(/webkit/) != -1),  //boolean - used for specific browser hack. if you want, you can force disable this flag & try to find crossbrowser solution
    ie6      : (/MSIE 6/i.test(navigator.userAgent)), //boolean - IDEM
    ie7      : (/MSIE 7/i.test(navigator.userAgent)), //boolean - IDEM
    labels   : {                 //labels of internal menu
      play : "play",
      next : "next",
      prev : "prev",
      stop : "stop",
      close: "close",
      info : "info"
    },
    timers   : {                 //timers 
      fade    : 400,           //fade duration
      interval: 7000,          //slideshow interval
      autohide: 7000           //autohide timeout
    },
    delays: {                    //delays (timers) to improve usability and reduce events
      mousemove: 200,          //used by autohide. cancel autohide timeout every XXXms. 
      resize   : 500,          //used by ie6 to reduce events handled by window.resize
      mouseover: 800           //used by tooltip. show tooltip only if the mouse STAY over thumb for XXXms
    },
    close    : function(){},     //callback handled by menu's button close. see demo. example : close : function(){window.close()}
    before   : function(){},     //callback handled BEFORE image gallery loaded
    after    : function(ev){},   //callback(ev) handled AFTER image gallery loaded. receive the native load event.
    load     : function(ev){},   //callback(ev) handled AFTER native image load event. receive the native load event.
    ready    : function(el){},   //callback(el) handled AFTER jbgallery render. receive the HTML element.
    //WHAT'S NEW - 3.0
    fullscreen: true,            //true|false : the most important feature of jbgallery 3.0. now jbgallery can "stay in a box" and have multiple istance in one page.
    push      : function(o){},   //callback handled by push public method (JBGALLERY API). receive the object/string/array of objects/array of strings passed from external. useful for external menu system
    unshift   : function(o){},   //callback handled by unshift public method (JBGALLERY API). receive the object/string/array of objects/array of strings passed from external.
    shift     : function(){},    //callback handled by shift public method 
    pop       : function(){},    //callback handled by pop public method 
    empty     : function(){}     //callback handled by empty public method 
  } 
};


jBGallery.Options = function(options, el){
    //OPTIONS
    var _metadata = {};
    
    if($.metadata)
        _metadata = $(el).metadata();
    
  var _settings = new jBGallery.Settings();
  
  var _options = $.extend(true, _settings,_metadata,options);
    
    if(_options.current !== 1)
     _options.randomize = 0;
  
  //15/12/2010 
  //- traditional popup use location.hash
  //- "modal" lightbox use the href.hash of handler (see demo)
  if(_options.popup && _options.current === 1){
     var _hash = parseInt(location.hash.replace("#",""),10);
     if(_hash)
         _options.current = _hash;
  } 
  _options.current--;
  if(_options.current < 0)
     _options.current = 0;

    //fade    
    if(!_options.fade)
        _options.timers.fade = 0;    
    
    //position absolute più sicuro (...ma bug su opera)
    if(_options.popup && _options.style == 'centered')
        _options.style = 'centered modal';
        
    return _options;    
};

